# 2. 利用已注册的用户名和密码实现登录功能
# list1 = ["admin","morning","eight","Mary"]
# list2 = ["1234","2234","3234","4234"]
# def login(name,pwd):
#     for i in range(0,len(list1)):
#         if list1[i] == name:
#             if list2[i] == pwd:
#                 print("登录成功")
#             else:
#                 print("密码错误")
#             break
#      else:
#          print("用户名错误")
#
# a = input("请输入用户名:")
# b = input("请输入密码：")
# login(a,b)

# 扩展要求：把两个列表减少为一个列表，完成同样的功能。列表中的列表。
list1 = [["admin","1234"],["morning","2234"],["eight","3234"],["Mary","4234"]]
def login(name,pwd):
    for i in range(0,len(list1)):
        if list1[i][0] == name:
            if list1[i][1] == pwd:
                print("登录成功")
            else:
                print("密码错误")
            break
    else:
         print("用户名错误")

a = input("请输入用户名:")
b = input("请输入密码：")
login(a,b)